package com.itclass.auth.authentication.token.supprt;


import com.itclass.auth.authentication.token.AbstractAuthenticationToken;
import com.itclass.auth.authentication.token.AbstractForwardAuthenticationToken;
import com.itclass.auth.pojo.dto.UserDetailsDTO;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * 简单的账号密码登录 适配器
 */
public class GitHubLoginAuthenticationToken extends AbstractForwardAuthenticationToken<UserDetailsDTO> {


    /**
     * github获取 token 编码
     */
    private Object principal;

    /**
     * 密码
     */
    private Object credentials;
    public GitHubLoginAuthenticationToken() {
        super(true);
    }
    public GitHubLoginAuthenticationToken(boolean authenticated,String principal) {
        super(authenticated);
        this.principal =principal;
    }

    @Override
    public Object getCredentials() {
        // 认证成功了，就不用在存储密码等重要信息到内存
        return null;
    }

    @Override
    public Object getPrincipal() {
        return principal;
    }

    public void setPrincipal(Object principal) {
        this.principal = principal;
    }



    public void setCredentials(Object credentials) {
        this.credentials = credentials;
    }
}
